package com.secxiot.provider;

import com.secxiot.provider.system.dto.AppSchedulDto;
import com.secxiot.provider.system.entity.AppPunchCard;
import com.secxiot.provider.system.entity.AppSchedulRecord;
import com.secxiot.provider.system.vo.AppPunchCardVo;
import com.secxiot.provider.system.vo.AppSchedulRecordVo;
import com.secxiot.provider.system.vo.AppSchedulVo;
import com.secxiot.provider.task.vo.TaskStatusVo;
import com.secxiot.provider.user.dto.BindDto;
import com.secxiot.provider.user.dto.UserDto;
import com.secxiot.provider.user.entity.UserAccount;
import com.secxiot.provider.user.entity.UserDo;
import com.secxiot.provider.user.vo.*;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

@RestController
public interface UserApi {

    /**
     * 根据用户id获取用户信息
     *
     * @param id 用户id
     * @return 用户信息
     */
    @GetMapping("/{id}")
    UserDo getUser(@PathVariable("id") Long id);

    /**
     * 获取用户信息
     *
     * @param mobile     手机号码
     * @param clientType 客户端类型
     * @return 用户信息
     */
    @GetMapping
    UserDo getUserByPhone(@RequestParam(value = "mobile", required = true) String mobile,
                          @RequestParam(value = "clientType", required = true) String clientType);

    /**
     * 根据微信openId获取用户信息
     *
     * @param wxOpenid 微信openId`
     * @return 用户信息
     */
    @GetMapping
    UserDo getUserByWxOpenid(@RequestParam String wxOpenid);

    /**
     * 用户注册
     *
     * @param userDto 注册信息
     * @return 用户信息
     */
    @PostMapping
    UserDo registry(@RequestBody UserDto userDto);

    /**
     * 修改用户信息
     *
     * @param userDto 需要更新的用户信息
     * @return 用户信息
     */
    @PutMapping
    UserDo update(@RequestBody UserDto userDto);

    /**
     * 扫码绑定关系
     *
     * @param bindDto 扫描对象
     * @return 数量
     */
    @PostMapping("/bind")
    Integer bindUserRel(@RequestBody BindDto bindDto);

    /**
     * 用户获取接收者列表
     *
     * @param userId   用户id
     * @param userType 用户类型，0000100001	患者
     * @param deptId   部门id，不传则不进行部门限制
     * @return 可用的用户列表
     */
    @GetMapping("/list")
    List<UserSimpleVo> getUserSimpleList(@RequestParam(value = "userId") Long userId,
                                         @RequestParam(value = "userType") List<String> userType,
                                         @RequestParam(value = "deptId") Long deptId,
                                         @RequestParam(value = "directFlag") Integer directFlag,
                                         @RequestParam(value = "taskType") String taskType);

    /**
     * 添加紧急联系人
     *
     * @param userId   用户id
     * @param relation 关系
     * @param name     姓名
     * @param mobile   手机号
     * @return 是否成功
     */
    @PostMapping("/contact")
    UserEmergencyContactVo addContact(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "relation", required = true) String relation,
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "mobile", required = true) String mobile);

    @GetMapping("/contact")
    UserEmergencyContactVo getContact(@RequestParam(value = "userId", required = true) Long userId);

    /**
     * 获取病患列表接口
     *
     * @param deptId
     * @return 病患列表
     */
    @GetMapping("/patientlist")
    List<PatientVo> getPatientList(@RequestParam(value = "deptId", required = true) Long deptId);

    /**
     * 获取SOS接收者
     *
     * @param hospitalId 医院id
     * @param deptId     部门id
     * @param taskType   任务类型
     * @return 接收者列表
     */
    @GetMapping("/sosReceiverList")
    List<UserSimpleVo> listHospitalSOSDoctor(
            @RequestParam(value = "hospitalId", required = true) Long hospitalId,
            @RequestParam(value = "deptId", required = false) Long deptId,
            @RequestParam(value = "taskType", required = true) String taskType);

    /**
     * 用户注册 -- 药品追踪记录小程序
     *
     * @param userDto 注册信息
     * @return 医药用户信息
     */
    @PostMapping("/narcoticRegistry")
    UserDo narcoticRegistry(@RequestBody UserDto userDto);

    /**
     * 用户注册---SOS小程序
     *
     * @param userDto 注册信息
     * @return 医药用户信息
     */
    @PostMapping("/sosRegistry")
    UserDo sosRegistry(@RequestBody UserDto userDto);

    /**
     * 添加考勤记录
     *
     * @param punchCard 打卡对象
     * @return
     */
    @PostMapping("/addPunchCard")
    Integer addPunchCard(@RequestBody AppPunchCard punchCard);

    /**
     * 获取考勤记录列表
     *
     * @param userId     用户ID
     * @param hospitalId 医院ID
     * @param dateTime   考勤时间
     * @return
     */
    @GetMapping("/punchCardList")
    List<AppPunchCardVo> getPunchCardList(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "hospitalId", required = true) Long hospitalId,
            @RequestParam(value = "dateTime", required = true) Date dateTime);

    /**
     * 获取打卡记录
     *
     * @param userId     用户ID
     * @param hospitalId 医院ID
     * @param punchType  打卡类型
     * @param punchTime  打卡时间
     * @return
     */
    @GetMapping("/getPunchCard")
    AppPunchCardVo getPunchCard(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "hospitalId", required = true) Long hospitalId,
            @RequestParam(value = "punchType", required = true) String punchType,
            @RequestParam(value = "punchTime", required = true) Date punchTime);

    /**
     * 添加排班
     *
     * @param appSchedulDto 排班对象
     * @return
     */
    @PostMapping("/schedul/add")
    Integer addAppSchedul(@RequestBody AppSchedulDto appSchedulDto) throws ParseException;

    /**
     * 添加排班记录
     *
     * @param appSchedulRecord 排班记录
     * @return
     */
    @PostMapping("/schedul/addRecord")
    Integer addAppSchedulRecord(@RequestBody AppSchedulRecord appSchedulRecord);

    /**
     * 获取排班列表
     *
     * @param userId     用户ID
     * @param hospitalId 医院ID
     * @return
     */
    @GetMapping("/schedul/List")
    List<AppSchedulVo> getAppSchedulList(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "hospitalId", required = true) Long hospitalId);

    /**
     * 获取排班记录列表
     *
     * @param userId     用户ID
     * @param hospitalId 医院ID
     * @param schedulId  排班ID
     * @return
     */
    @GetMapping("/schedul/recordList")
    List<AppSchedulRecordVo> getAppSchedulRecordList(
            @RequestParam(value = "userId", required = true) Long userId,
            @RequestParam(value = "hospitalId", required = true) Long hospitalId,
            @RequestParam(value = "schedulId", required = true) Long schedulId);

    /**
     * 获取微信对象
     *
     * @param appId 微信AppID
     * @return
     */
    @GetMapping("/app")
    WxAppVo getWxApp(@RequestParam(value = "appId", required = true) String appId);

    /**
     * 获取任务接收者当前任务
     *
     * @param receiverId 接收人用户ID
     * @return
     */
    @GetMapping("/getTaskByReceiverId")
    List<TaskStatusVo> getTaskByReceiverId(@RequestParam("receiverId") Long receiverId);

    /**
     * 获取分享用户列表
     *
     * @param userId 用户ID
     * @return
     */
    @PostMapping("/getPromoteUserList")
    List<UserVo> getPromoteUserList(@RequestParam("userId") Long userId,
                                    @RequestParam("pageNo") Long pageNo,
                                    @RequestParam("pageSize") Long pageSize);

    /**
     * 绑定分享码
     *
     * @param userId      用户ID
     * @param promoteCode 邀请码
     * @return
     */
    @PostMapping("/bingPromoteCode")
    Integer bingPromoteCode(@RequestParam("userId") Long userId,
                            @RequestParam("promoteCode") String promoteCode);

    /**
     * 绑定用户提现账号
     *
     * @param userId     用户ID
     * @param type       账户类型
     * @param payAccount 账号
     * @return
     */
    @PostMapping("/bingUserAccount")
    Integer bingUserAccount(@RequestParam(value = "userId") Long userId,
                            @RequestParam(value = "type") Integer type,
                            @RequestParam(value = "payAccount") String payAccount);

    /**
     * 编辑用户提现账号
     *
     * @param userId     用户ID
     * @param type       账户类型
     * @param payAccount 账号
     * @return
     */
    @PostMapping("/editUserAccount")
    Integer editUserAccount(@RequestParam(value = "userId") Long userId,
                            @RequestParam(value = "type") Integer type,
                            @RequestParam(value = "payAccount") String payAccount);

    @GetMapping("/getUserAccount")
    UserAccount getUserAccount(@RequestParam(value = "userId", required = true) Long userId);
}
